{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0b8d6be2-c44c-410e-a976-41d8823a1247",
   "metadata": {},
   "source": [
    "# 查看wsl dockers 的安装目录\n",
    "(Get-ChildItem -Path HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Lxss | Where-Object { $_.GetValue(\"DistributionName\") -eq 'docker-desktop' }).GetValue(\"BasePath\") + \"\\ext4.vhdx\"\n",
    "\n",
    "- 输出结果： \\\\?\\C:\\Users\\Administrator\\AppData\\Local\\Docker\\wsl\\distro\\ext4.vhdx\n",
    "\n",
    "\n",
    "# 移动wsl在系统盘的位置\n",
    "1. 查看自己的wsl和ubuntu版本；\n",
    "wsl -l -v\n",
    "\n",
    "# 输出结果\n",
    "```Bash\n",
    "  NAME                   STATE           VERSION\r",
    "   docker-desktop-data    Stopped         2\r\n",
    "  docker-desktop         Stopped         * \n",
    "  Ubuntu-22.04           Running         2\n",
    "```\n",
    "                                                                                          \n",
    "2. 关闭wsl服务；\n",
    "wsl --shutdown // 关闭所有的wsl系统\n",
    "wsl --terminate name // 关闭特定的wsl系统\n",
    "                                                                                          \n",
    "3. 将原位置的ubuntu导出到指定位置；\n",
    "wsl --export Ubuntu-22.04 E:\\wsl-v2\\Ubuntu-22.04\\wsl-Ubuntu-22.04.tar // 到处关闭的wsl系统，默认是tar格式\n",
    "\n",
    "4. 原wsl注销ubuntu；\n",
    "wsl --unregister Ubuntu-22.04 //注销 wsl 系统\n",
    "\n",
    "5. 在指定位置(我的是E盘)导入ubuntu；\n",
    "wsl --import Ubuntu-22.04 E:\\wsl-v2\\Ubuntu-22.04 E:\\wsl-v2\\Ubuntu-22.04\\wsl-Ubuntu-22.04.tar //导入新位置的wsl系统\n",
    "\n",
    "6. 修改用户名为原来的名字。\n",
    "此步骤我没有做。\n",
    "\n",
    "7. 启动新位置wls系统\n",
    "wsl -d Ubuntu-22.04"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
